package com.lan.qipan;
import java.util.Scanner;

public class Main {
	static int[][] p;
	
	
	static void add(int x, int y, int a, int b, int v) {
		p[x][y] += v;
		p[x][b + 1] -= v;
		p[a + 1][y] -= v;
		p[a + 1][b + 1] += v;
	}
	
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		p = new int[n + 2][n + 2];	
		for (int t = 0; t < m; t ++) {
			
			int x, y, a, b;
			x = scanner.nextInt();			
			y = scanner.nextInt();
			a = scanner.nextInt();
			b = scanner.nextInt();
			
			add(x, y, a, b, 1);
			
		}
		for (int i = 1; i <= n; i ++) {
			for (int j = 1; j <= n; j ++) {
				p[i][j] += p[i-1][j] + p[i][j-1] - p[i-1][j-1];
				System.out.printf("%d", p[i][j] % 2 == 0 ? 0 : 1);
			}
			System.out.println();
		}
	}
}

